#include <stdio.h>
#include <stdlib.h>
#include "../Biblioteca/leitor.h"
#include "token.h"
#include "lexico.h"
#include "tabelas.h"
#include "../Biblioteca/saida.h"
#include "../Sintatico/sintatico.h"
#include "../Semantico/acoes.h"
#include "../Semantico/semantico.h"

int main (int argc, const char * argv[]) {

/*PARA TESTE DO LEXICO*/
///* initialize the file reader */
//init_reader("../Resources/ENTRADA.txt");
//
///* initialize transducer automata transitions */
//initialize_transitions();
//
///* initialize semantic tables */
//initialize_semantic_tables();
//
///* loop that reads all tokens from source code */
//while (token.type != TOKEN_TYPE_END_OF_FILE) {
//	get_next_token(0);
//
//	if (token.type != TOKEN_TYPE_END_OF_FILE) {
//		printf("Token: %s (%d) :: %s (%d) :: linha %i, coluna%i\n",  token.value, token.index, token_type_name(), token.type, token.line, token.column);
//	}
//
//}

	/* initialize the file reader */
	init_reader("../Resources/semantico.txt");
	//init_reader("../../../resources/sampleOsimplesLevaAoComplexo.edu");

	initialize_writer("../Resources/sample.asm");

	/* initialize transducer automata transitions */
	initialize_transitions();

	/* initialize semantic */
	initialize_semantic();

	/* initialize semantic actions */
	init_semantic_actions();

	// start APE machines
	init_ape_machines();

	/* call sintatic analyser*/
	run_sintatic();

	close_writer();

return 0;
}
